﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SendMessageForm.aspx.cs"
    Inherits="FantastPlatform.Community.UI.Message.SendMessageForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        var smf = new FantastPlatform.UI.SendMessageForm({
            renderTo: 'smf_div',
            groupName: "<% =groupName%>",
            pId: "<%= pIdStr %>",
            url: '../Service/MailList.aspx?Action=SendMessage',
            tbar: [{
                text: '发送',
                iconCls: 'sendMsg',
                handler: function () { submitFormToJson(smf, currtWind, null); }
            }, '-', {
                text: '重置',
                iconCls: 'cancel',
                handler: function () { mlf.form.reset(); }
            }]
        });
    function submitFormToJson(form, sender, fn) {
    if (form.form.isValid()) {
        var myMask = new Ext.LoadMask(form.getEl(), {
            msg: "正在发送处警信息,请稍候...."
        });
        myMask.show();
        //                    var dataStr = Ext.util.JSON.encode(form.form.getValues());
        var dataStr1 = Ext.getCmp('socket').getValue();     
        var msg = Ext.getCmp("MessageInfo").getValue();
         Ext.Ajax.request({
            method: 'post',
            url: '../Service/MailList.aspx?Action=SendMessage',
            params: {  message: msg, ids: dataStr1, PoliceManNumber: parent.policemanNumber },
            success: onSuccess,
            failure: onFailure
        });

        function onSuccess(request, options) {
            myMask.hide();
            var reText = request.responseText;
            var reTextObj = Ext.util.JSON.decode(reText);
            if (eval(reTextObj.success)) {
                showMessage("发送成功", reTextObj.message);
                if (sender)
                    sender.close();
                if (fn)
                    fn.call(this, reText);
            } else {
                showErrorMessage('发送失败', reTextObj.message, '');
            }
        };

        function onFailure(request, options) {
            myMask.hide();
            showErrorMessage('发送失败', request.responseText, '');
        }
    }
}       
    </script>
</head>
<body>
    <div id="smf_div">
    </div>
</body>
</html>
